package com.forsythia.sns;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

import org.apache.commons.lang.time.DurationFormatUtils;

public class DateUtils {

    public static TimeZone timeZone = TimeZone.getTimeZone("GMT+8");
    public static Locale locale = Locale.CHINA;
    
    public static String Duration_FORMAT = "dd天HH小时mm分钟ss秒";

    public static String toLunarString(Date date) {
        Calendar cal = Calendar.getInstance(timeZone, locale);
        if (date != null) {
            cal.setTime(date);
        }
        return new Lunar(cal).toString();
    }

    public static String toDurationString(Date date) {
        return DurationFormatUtils.formatPeriod(date.getTime(), new Date().getTime(), Duration_FORMAT);
    }

}
